package com.neudu.yiyang.pojo;

import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;

/**
 * 护理记录数据传输对象
 */
@Data
public class NurserecordDTO {
    /**
     * 主键ID
     */
    private Integer id;

    /**
     * 客户ID
     */
    private Integer customerId;

    /**
     * 客户姓名
     */
    private String customerName;

    /**
     * 护理项目ID
     */
    private Integer itemId;

    /**
     * 护理时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date nursingTime;

    /**
     * 护理内容
     */
    private String nursingContent;

    /**
     * 护理次数
     */
    private Integer nursingCount;

    /**
     * 护理人员ID
     */
    private Integer userId;

    /**
     * 上期剩余数量
     */
    private Integer lastRemainingCount;

    /**
     * 本期剩余数量
     */
    private Integer currentRemainingCount;

    /**
     * 购买时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date purchaseTime;

    /**
     * 购买次数
     */
    private Integer purchaseCount;

    /**
     * 总购买次数
     */
    private Integer totalCount;

    /**
     * 备注
     */
    private String remark;

    /**
     * 服务状态
     */
    private String status;

    /**
     * 从实体类转换的静态方法
     */
    @TableLogic
    private Integer isDeleted;
    public static NurserecordDTO fromEntity(Nurserecord record, String customerName) {
        NurserecordDTO dto = new NurserecordDTO();
        dto.setId(record.getId());
        dto.setCustomerId(record.getCustomerId());
        dto.setCustomerName(customerName);
        dto.setItemId(record.getItemId());
        dto.setNursingTime(record.getNursingTime());
        dto.setNursingContent(record.getNursingContent());
        dto.setNursingCount(record.getNursingCount());
        dto.setUserId(record.getUserId());
        dto.setLastRemainingCount(record.getLastRemainingCount());
        dto.setCurrentRemainingCount(record.getCurrentRemainingCount());
        dto.setPurchaseTime(record.getPurchaseTime());
        dto.setPurchaseCount(record.getPurchaseCount());
        dto.setTotalCount(record.getTotalCount());
        dto.setRemark(record.getRemark());
        dto.setStatus(record.getStatus());
        return dto;
    }
}